<?php
/**
 @prefix : <http://purl.org/net/ns/doas#> .
 @about: "<app/models/mml.php>", a: ":PHPScript",
 :shortdesc "MML model class.";
 :author [:name "Logue"; :homepage <http://logue.be/> ];
 :license <http://www.gnu.org/licenses/gpl-3.0.html>;
 :dependencies "none" .
*/
// Lorelei Copyright (C) 2008 by Logue
// This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
// This is free software, and you are welcome to redistribute it
// under certain conditions; type `show c' for details.

// Do not delete these text.
class Mml extends AppModel {

	var $name = 'Mml';
	var $validate = array(
		'id' => array('numeric'),
		'rank_id' => array('numeric'),
		'article_id' => array('numeric'),
		'user_id' => array('numeric'),
		'instrument_id' => array('numeric'),
		'pan' => array('numeric'),
		'ch1' => array(
			array(
				'rule' => array('maxLength', '1200'),
				'massage'=>'ch1 of mml is too long. less than 1200 characters.'
			),
			array(
				'rule' => array('custom', '/[abcdefglnortvABCDEFGLNORTV<>][\+\#-]?[0-9]*\.?&?/i'),
				'massage'=>'The character which cannot be used is contained in ch1.'
			)
		), 
		'ch2' => array(
			array(
				'rule' => array('maxLength', '800'),
				'massage'=>'ch2 of mml is too long. less than 800 characters.'
			),
			array(
				'rule' => array('custom', '/[abcdefglnortvABCDEFGLNORTV<>][\+\#-]?[0-9]*\.?&?/i'),
				'massage'=>'The character which cannot be used is contained in ch2.'
			)
		), 
		'ch3' => array(
			array(
				'rule' => array('maxLength', '500'),
				'massage'=>'ch3 of mml is too long. less than 500 characters.'
			),
			array(
				'rule' => array('custom', '/[abcdefglnortvABCDEFGLNORTV<>][\+\#-]?[0-9]*\.?&?/i'),
				'massage'=>'The character which cannot be used is contained in ch3.'
			)
		)
	);

	//The Associations below have been created with all possible keys, those that are not needed can be removed
	var $belongsTo = array(
			'Article' => array('className' => 'Article',
								'foreignKey' => 'article_id',
								'conditions' => '',
								'fields' => 'Article.id,Article.title,Article.user_id',
								'order' => ''
			),
			'User' => array('className' => 'User',
								'foreignKey' => 'user_id',
								'conditions' => '',
								'fields' => 'User.id,User.username',
								'order' => ''
			),
			'Instrument' => array('className' => 'Instrument',
								'foreignKey' => 'instrument_id',
								'conditions' => '',
								'fields' => '',
								'order' => ''
			),
			'Rank' => array('className' => 'Rank',
								'foreignKey' => 'rank_id',
								'conditions' => '',
								'fields' => 'Rank.id,Rank.name',
								'order' => ''
			)
	);
}
?>